<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:pe="http://primefaces.org/ui/extensions"
      xmlns:hr="http://java.sun.com/jsf/composite/autocomplete">

    <h:body>

        <ui:composition template="/resources/template/template.xhtml">

            <ui:define name="content">

                <h:form >
                    <p:panel >
                        <f:facet name="header" >
                            <h:outputLabel value="Staff Shift Detail By Staff" />
                        </f:facet>
                        <h:panelGrid columns="2" >
                            <h:outputLabel value="Select Salary Cycle"/>
                            <p:selectOneMenu id="advanced" 
                                             value="#{hrReportController.salaryCycle}" 
                                             converter="salaryCycleConverter" 
                                             effect="fade" var="t" 
                                             filter="true" 
                                             filterMatchMode="startsWith">
                                <f:selectItems value="#{salaryCycleController.salaryCycles}" 
                                               var="theme" 
                                               itemLabel="#{theme.name}" 
                                               itemValue="#{theme}" ></f:selectItems>

                                <p:column style="width:10%" headerText="Name">
                                    <h:outputText value="#{t.name}" />
                                </p:column>

                                <p:column headerText="Year">
                                    <h:outputText value="#{t.salaryYear}" />
                                </p:column>
                                <p:column headerText="Month">
                                    <h:outputText value="#{t.salaryMonth}" />
                                </p:column>
                            </p:selectOneMenu>
                            <h:outputLabel value="Staff : "/>
                            <hr:completeStaff value="#{hrReportController.reportKeyWord.staff}"/>                          
                        </h:panelGrid>

                        <p:commandButton ajax="false" value="Process" action="#{hrReportController.createStaffWrokedDetail()}"/>
                        <p:commandButton ajax="false" value="Reset" action="#{hrReportController.reset()}"/>
                        <p:commandButton ajax="false" value="Excel" styleClass="noPrintButton" onclick="onSubmitButton();" >
                            <pe:exporter type="xlsx" target="tb1" fileName="hr_report_summery_by_staff"  />
                        </p:commandButton>
                        <p:commandButton value="Print" ajax="false" action="#" >
                            <p:printer target="gpBillPreview" ></p:printer>
                        </p:commandButton>
                        <p:panel id="gpBillPreview" styleClass="noBorder summeryBorder">                     
                            <p:dataTable id="tb1" value="#{hrReportController.staffShiftsNormal}" var="ss">
                                <f:facet name="header" >
                                    <p:outputLabel value="#{sessionController.loggedUser.institution.name}" /><br></br>
                                    <h:outputLabel style="text-align: center" value="  Staff Shift Detail By Staff "  /><br/>
                                    <h:outputLabel value="Salary Cycle : #{hrReportController.reportKeyWord.salaryCycle.name}" /><br/>
                                    <h:panelGroup rendered="#{hrReportController.reportKeyWord.staff ne null}" >
                                        <h:outputLabel value="Staff : #{hrReportController.reportKeyWord.staff.person.name}"/>
                                        <br/>
                                    </h:panelGroup>

                                </f:facet><br/>
                                <f:facet name="header">
                                    <h:outputLabel style="text-align: center" value="  Worked Normal Day : "  />                                 
                                </f:facet>                                                                                              
                                <p:column headerText=" Shift">
                                    <f:facet name="header" >
                                        <p:outputLabel value=" Shift" ></p:outputLabel>
                                    </f:facet>
                                    <p:outputLabel value="#{ss.shift.name}" ></p:outputLabel>
                                </p:column>
                                <p:column headerText="Staff Shift id">                                  
                                    <p:outputLabel value="#{ss.id}" ></p:outputLabel>
                                </p:column>
                                <p:column headerText="Form id">                                  
                                    <p:outputLabel value="#{ss.leaveForm.id}" ></p:outputLabel>
                                </p:column>
                                <p:column headerText="Late In">                                  
                                    <p:outputLabel value="#{ss.lateInVarified}" rendered="#{ss.lateInVarified>=(10*60)}" > <f:converter converterId="longToTime"/></p:outputLabel>
                                </p:column>
                                <p:column headerText="Late In Ref Shift id">                                  
                                    <p:outputLabel value="#{ss.referenceStaffShiftLateIn.id}" ></p:outputLabel>
                                </p:column>
                                <p:column headerText="Early Out">                                  
                                    <p:outputLabel value="#{ss.earlyOutVarified}"  rendered="#{ss.earlyOutVarified>=(10*60)}" > <f:converter converterId="longToTime"/></p:outputLabel><br/>
                                </p:column>
                                <p:column headerText="Early OutRef Shift id">                                  
                                    <p:outputLabel value="#{ss.referenceStaffShiftEarlyOut.id}" ></p:outputLabel>
                                </p:column>
                                <p:column headerText="Auto">                                  
                                    <p:outputLabel value="#{ss.considerForLateIn}" ></p:outputLabel>
                                    <p:outputLabel value="#{ss.considerForEarlyOut}" ></p:outputLabel>
                                    <p:outputLabel value="#{ss.autoLeave}" ></p:outputLabel>

                                </p:column>
                                <p:column headerText="Leave Type">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Leave Type" ></p:outputLabel>
                                    </f:facet>
                                    <h:outputLabel value="#{ss.leaveType}"/>
                                </p:column>


                                <p:column headerText="Day Type">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Day Type" ></p:outputLabel>
                                    </f:facet>
                                    <h:outputLabel value="#{ss.dayType}"/>
                                </p:column>

                                <p:column headerText="Shift Date">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Shift Date" ></p:outputLabel>
                                    </f:facet>
                                    <h:outputLabel value="#{ss.shiftDate}">
                                        <f:convertDateTime pattern="dd/MM/yy"/>
                                    </h:outputLabel>
                                </p:column>

                                <p:column headerText="In Time ">
                                    <f:facet name="header" >
                                        <p:outputLabel value="In Time" ></p:outputLabel>
                                    </f:facet>
                                    <h:outputLabel value="#{ss.startRecord.recordTimeStamp}">
                                        <f:convertDateTime pattern="hh:mm:ss a"/>
                                    </h:outputLabel>  
                                </p:column>                           
                                <p:column headerText="Out Time">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Out Time" ></p:outputLabel>
                                    </f:facet>
                                    <h:outputLabel value="#{ss.endRecord.recordTimeStamp}">
                                        <f:convertDateTime pattern="hh:mm:ss a"/>
                                    </h:outputLabel>  
                                </p:column>  
                                <p:column headerText="Worked Time">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Worked Time" />
                                    </f:facet>
                                    <h:outputLabel value="#{ss.workedWithinTimeFrameVarified}">
                                        <f:converter converterId="longToTime"/>
                                    </h:outputLabel>
                                    <f:facet name="footer">
                                        <h:outputLabel value="#{hrReportController.totalWorkedTime}">
                                            <f:converter converterId="longToTime"/>
                                        </h:outputLabel>
                                    </f:facet>
                                </p:column>                     

                            </p:dataTable>

                            <p:dataTable id="tb2" value="#{hrReportController.staffShiftsHoliday}" var="ss">
                                <f:facet name="header">
                                    <h:outputLabel style="text-align: center" value=" Worked  Holiday Day : "  />                                 
                                </f:facet>                                                                                              
                                <p:column headerText="Staff Shift">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Staff Shift" ></p:outputLabel>
                                    </f:facet>
                                    <p:outputLabel value="#{ss.shift.name}" ></p:outputLabel>
                                </p:column>
                                <p:column headerText="Day Type">
                                    <h:outputLabel value="#{ss.dayType}"/>
                                </p:column>
                                <p:column headerText="Multiply">
                                    <h:outputLabel value="#{ss.multiplyingFactorSalary}"/>
                                </p:column>
                                <p:column headerText="Shift Date">
                                    <h:outputLabel value="#{ss.shiftDate}">
                                        <f:convertDateTime pattern="dd/MM/yy"/>
                                    </h:outputLabel>
                                </p:column>

                                <p:column headerText="In Time ">
                                    <f:facet name="header" >
                                        <p:outputLabel value="In Time" ></p:outputLabel>
                                    </f:facet>
                                    <h:outputLabel value="#{ss.startRecord.recordTimeStamp}">
                                        <f:convertDateTime pattern="hh:mm:ss a"/>
                                    </h:outputLabel>  
                                </p:column>                           
                                <p:column headerText="Out Time">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Out Time" ></p:outputLabel>
                                    </f:facet>
                                    <h:outputLabel value="#{ss.endRecord.recordTimeStamp}">
                                        <f:convertDateTime pattern="hh:mm:ss a"/>
                                    </h:outputLabel>  
                                </p:column>  
                                <p:column headerText="Worked Time">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Worked Time" />
                                    </f:facet>
                                    <h:outputLabel value="#{ss.workedWithinTimeFrameVarified}">
                                        <f:converter converterId="longToTime"/>
                                    </h:outputLabel>
                                </p:column>                                 
                            </p:dataTable>

                            <p:dataTable id="tb3" value="#{hrReportController.staffShiftsDayOff}" var="ss">
                                <f:facet name="header">
                                    <h:outputLabel style="text-align: center" value=" Worked  Day Off Day : "  />                                 
                                </f:facet>                                                                                              
                                <p:column headerText="Staff Shift">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Staff Shift " ></p:outputLabel>
                                    </f:facet>
                                    <p:outputLabel value="#{ss.shift.name}" ></p:outputLabel>
                                </p:column>
                                <p:column headerText="Day Type">
                                    <h:outputLabel value="#{ss.dayType}"/>
                                </p:column>

                                <p:column headerText="Shift Date">
                                    <h:outputLabel value="#{ss.shiftDate}">
                                        <f:convertDateTime pattern="dd/MM/yy"/>
                                    </h:outputLabel>
                                </p:column>

                                <p:column headerText="In Time ">
                                    <f:facet name="header" >
                                        <p:outputLabel value="In Time" ></p:outputLabel>
                                    </f:facet>
                                    <h:outputLabel value="#{ss.startRecord.recordTimeStamp}">
                                        <f:convertDateTime pattern="hh:mm:ss a"/>
                                    </h:outputLabel>  
                                </p:column>                           
                                <p:column headerText="Out Time">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Out Time" ></p:outputLabel>
                                    </f:facet>
                                    <h:outputLabel value="#{ss.endRecord.recordTimeStamp}">
                                        <f:convertDateTime pattern="hh:mm:ss a"/>
                                    </h:outputLabel>  
                                </p:column>  
                                <p:column headerText="Worked Time">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Worked Time" />
                                    </f:facet>
                                    <h:outputLabel value="#{ss.workedWithinTimeFrameVarified}">
                                        <f:converter converterId="longToTime"/>
                                    </h:outputLabel>
                                </p:column>                                 
                            </p:dataTable>

                            <p:dataTable id="tb4" value="#{hrReportController.staffShiftExtraDuties}" rowIndexVar="i" var="ss">
                                <f:facet name="header">
                                    <h:outputLabel style="text-align: center" value="  Extra Duties Report : "  />                                 
                                </f:facet>            
                                <p:column headerText="No">
                                    <h:outputLabel value="#{i+1}"/>
                                </p:column>
                                <p:column headerText="Staff Shift">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Staff Shift" ></p:outputLabel>
                                    </f:facet>
                                    <p:outputLabel value="#{ss.shift.name}" ></p:outputLabel>
                                </p:column>
                                <p:column headerText="Day Type">
                                    <h:outputLabel value="#{ss.dayType}"/>
                                </p:column>
                                <p:column headerText="In Time ">
                                    <f:facet name="header" >
                                        <p:outputLabel value="In Time" ></p:outputLabel>
                                    </f:facet>
                                    <h:outputLabel value="#{ss.startRecord.recordTimeStamp}">
                                        <f:convertDateTime pattern="dd/MM/yy hh:mm:ss a"/>
                                    </h:outputLabel>  
                                </p:column>                           
                                <p:column headerText="Out Time">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Out Time" ></p:outputLabel>
                                    </f:facet>
                                    <h:outputLabel value="#{ss.endRecord.recordTimeStamp}">
                                        <f:convertDateTime pattern="dd/MM/yy hh:mm:ss a"/>
                                    </h:outputLabel>  
                                </p:column>  
                                <p:column headerText="Worked Time">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Worked Time" />
                                    </f:facet>
                                    <h:outputLabel value="#{ss.workedWithinTimeFrameVarified}">
                                        <f:converter converterId="longToTime"/>
                                    </h:outputLabel>
                                </p:column>  

                                <p:column headerText="Extra Time">
                                    <f:facet name="header" >
                                        <p:outputLabel value="Extra Time" />
                                    </f:facet>
                                    <h:outputLabel value="#{ss.extraTimeFromStartRecordVarified+ss.extraTimeFromEndRecordVarified}">
                                        <f:converter converterId="longToTime"/>
                                    </h:outputLabel>
                                </p:column>  
                            </p:dataTable>

                            <p:dataTable id="tb5" value="#{hrReportController.staffLeavesNoPay}" var="ss">
                                <f:facet name="header" >
                                    <h:panelGrid columns="4" style="border-style: hidden!important">
                                        <h:outputLabel value="No Pay Add By User "/>                                      
                                    </h:panelGrid>
                                </f:facet> 
                                <p:column headerText="Leave Date" >
                                    <p:outputLabel value="#{ss.leaveDate}"></p:outputLabel>
                                </p:column>  
                                <p:column headerText="Leave Qty" >
                                    <p:outputLabel value="#{ss.qty}"></p:outputLabel>
                                </p:column> 
                                <p:column headerText="Comments" >
                                    <p:outputLabel value="#{ss.form.comments}"></p:outputLabel>
                                </p:column> 

                            </p:dataTable>

                            <p:dataTable id="tb6" value="#{hrReportController.staffLeaveSystem}" var="ss">
                                <f:facet name="header" >
                                    <h:panelGrid columns="4" style="border-style: hidden!important">
                                        <h:outputLabel value="Late Attendance Leave"/>                                      
                                    </h:panelGrid>
                                </f:facet> 
                                <p:column headerText="id" >
                                    <p:outputLabel value="#{ss.id}"></p:outputLabel>
                                </p:column>
                                <p:column headerText="Leave Date" >
                                    <p:outputLabel value="#{ss.leaveDate}"></p:outputLabel>
                                </p:column>
                                <p:column headerText="Leave Type" >
                                    <p:outputLabel value="#{ss.leaveType}"></p:outputLabel>
                                </p:column>

                                <p:column headerText="Leave Qty" >
                                    <p:outputLabel value="#{ss.qty}"></p:outputLabel>
                                </p:column> 
                                <p:column headerText="Comments" >
                                    <p:outputLabel value="#{ss.form.comments}"></p:outputLabel>
                                </p:column> 

                                <f:facet name="footer">
                                    <p:outputLabel value="Print By : #{sessionController.loggedUser.webUserPerson.name} - " />
                                    <p:outputLabel value="Print At : " />
                                    <p:outputLabel value="#{commonController.currentDateTime}" >
                                        <f:convertDateTime pattern="yyyy MMMM dd hh:mm:ss a " />
                                    </p:outputLabel>
                                </f:facet>
                            </p:dataTable>



                        </p:panel>


                    </p:panel>

                </h:form>
            </ui:define>

        </ui:composition>

    </h:body>
</html>
